$(function() {
	var msgTitle= getLanMsgs("0ec22400-000001");
	var msgProdPrice= getLanMsgs("0ec22400-000002");
	var msgBiddingProj= getLanMsgs("0ec22400-000003");
	var msgBadProj= getLanMsgs("0ec22400-000004");
	var prodPriceUrl = "javascript:showCfmMsg('"+msgTitle+"','"+msgProdPrice+"')";
	var biddingProjUrl = "javascript:showCfmMsg('"+msgTitle+"','"+msgBiddingProj+"')";
	var badProjUrl = "javascript:showCfmMsg('"+msgTitle+"','"+msgBadProj+"')";
	//if(isEcSupp == "true" || isEcSupp == true){
		prodPriceUrl = "/ebvp/prodprice/prodpricelist?menuid=47";
		biddingProjUrl = "/ebvp/sourcing/biddingprojlist?menuid=21";
		badProjUrl = "/ebvp/sourcing/badeprojlist?menuid=22";
	//}
	var msg1= getLanMsgs("0ec22400-000006");
	var msg2= getLanMsgs("0ec22400-000007");
	var msg3= getLanMsgs("0ec22400-000008");
	var msg4= getLanMsgs("0ec22400-000009");
	var msg5= getLanMsgs("0ec22400-000010");
	var msg6= getLanMsgs("0ec22400-000011");
	var msg7= getLanMsgs("0ec22400-000012");
	var msg8= getLanMsgs("0ec22400-000013");
	var msg9= getLanMsgs("0ec22400-000014");
	var msg10= getLanMsgs("0ec22400-000015");
	var msg11= getLanMsgs("0ec22400-000016");
	var msg12= getLanMsgs("0ec22400-000017");
	var msg13= getLanMsgs("0ec22400-000018");
	var msg14= getLanMsgs("0ec22400-000019");
	var msg15= getLanMsgs("0ec22400-000020");
	var msg16= getLanMsgs("0ec22400-000021");
	var msg17= getLanMsgs("0ec22400-000022");
	var msg18= getLanMsgs("0ec22400-000023");
	var msg19= getLanMsgs("0ec22400-000024");
	var msg20= getLanMsgs("0ec22400-000025");
	var msg21= getLanMsgs("0ec22400-000026");
	var msg22= getLanMsgs("0ec22400-000027");
	var msg23= getLanMsgs("0ec22400-000028");
	var msg24= getLanMsgs("0ec22400-000029");
	var msg25= getLanMsgs("0ec22400-000030");
	var msg26= getLanMsgs("0ec22400-000031");
	var msg27= getLanMsgs("0ec22400-000032");
	var msg28= getLanMsgs("0ec22400-000033");
	var msg29= getLanMsgs("0ec22400-000034");
	var msg30= getLanMsgs("0ec22400-000035");
	var msg31= getLanMsgs("0ec22400-000036");
	var msg32= getLanMsgs("0ec22400-000037");
	var msg33= getLanMsgs("0ec22400-000038");
	var msg34= getLanMsgs("0ec22400-000039");
    var selfServiceStd = [
        {
            'itemId': "menuItem0",
            'itemName': msg1,
            'needShow':true,
            "itemUrl": "/ebvp/selfinfo/password?menuid=41"
        },
        {
            'itemId': "menuItem1",
            'itemName': msg2,
            'needShow':bModuleSRM,
            "itemUrl": "/ebvp/selfinfo/userinfo?menuid=42"
        },
        {
            'itemId': "menuItem2",
            'itemName': msg3,
            'needShow':bModuleSRM,
            "itemUrl": "/ebvp/selfinfo/editinfo?menuid=43"
        },
        {
            'itemId': "menuItem3",
            'itemName': msg4,
            'needShow':bModuleSRM,
            "itemUrl": "/ebvp/selfinfo/contractlist?menuid=46"
        },
        {
            'itemId': "menuItem4",
            'itemName': msg5,
            'needShow':bModuleEBP,
            "itemUrl": prodPriceUrl
        },
        {
            'itemId': "menuItem5",
            'itemName': msg6,
            'needShow':bModuleEBP,
            "itemUrl": "/ebvp/infopub/viewfile?menuid=48"
        }
    ];
    var selfServiceGh = [
                           {
					            'itemId': "menuItem0",
					            'itemName': msg1,
					            'needShow':true,
					            "itemUrl": ".",
					            'callback': function() { window.open("https://chinajvs.towngas.com.cn/iisadmpwd/aexp2b.asp"); return false; }  //港华修改密码的地址
					       },
                          {
                              'itemId': "menuItem1",
                              'itemName': msg2,
                              'needShow':bModuleSRM,
                              "itemUrl": "/ebvp/selfinfo/userinfo?menuid=42"
                          },
                          {
                              'itemId': "menuItem2",
                              'itemName': msg3,
                              'needShow':bModuleSRM,
                              "itemUrl": "/ebvp/selfinfo/editinfo?menuid=43"
                          },
                          {
                              'itemId': "menuItem3",
                              'itemName': msg4,
                              'needShow':bModuleSRM,
                              "itemUrl": "/ebvp/selfinfo/contractlist?menuid=46"
                          },
                          {
                              'itemId': "menuItem4",
                              'itemName': msg5,
                              'needShow':bModuleEBP,
                              "itemUrl": prodPriceUrl
                          },
                          {
                              'itemId': "menuItem5",
                              'itemName': msg6,
                              'needShow':bModuleEBP,
                              "itemUrl": "/ebvp/infopub/viewfile?menuid=48"
                          }
                      ];
   
    if(bStdVersion){
		$( "#selfService" ).UIDropMenu({ "menuId": "selfServiceMenu", 'items': selfServiceStd, 'alignRight': true });
	}else{
		$( "#selfService" ).UIDropMenu({ "menuId": "selfServiceMenu", 'items': selfServiceGh, 'alignRight': true });
	}
    
    var signedIn = [
        {
            'itemId': "nav0",
            'itemName': msg7,
            'needShow': "true",
            'itemUrl': "/ebvp/infopub/pubmain"
        },
        {
            'itemId': "nav1",
            'itemName': msg8,
            'needShow': bModuleEBP,
            'itemUrl': ".",
            'callback': function() {
        		return false;
        	},
            'subMenu': [
                {
                    'itemId': "nav1menuItem0",
                    'itemName': msg9,
                    'needShow': bModuleEBP,
                    "itemUrl": biddingProjUrl
                },
                {
                    'itemId': "nav1menuItem1",
                    'itemName': msg10,
                    'needShow': bModuleEBP,
                    "itemUrl": badProjUrl
                }
            ]
        },
        {
            'itemId': "nav2",
            'itemName': msg11,
            'itemUrl': ".",
            'needShow': bModuleEBPOrSCM_CT,
            'subMenu': [
                {
                    'itemId': "nav2menuItem0",
                    'itemName': msg12,
                    'needShow': bModuleEBPOrSCM_CT && bStdVersion,
                    "itemUrl": "/ebvp/contract/contractconfirm?menuid=38"
                },
                {
                    'itemId': "nav2menuItem1",
                    'itemName': msg13,
                    'needShow': bModuleEBPOrSCM_CT,
                    "itemUrl": "/ebvp/contract/contractlist?menuid=34"
                },
                {
                    'itemId': "nav2menuItem3",
                    'itemName': msg14,
                    'needShow': bModuleEBP && bStdVersion,
                    "itemUrl": "/ebvp/contractprice/ctreptlist?menuid=35"
                }, {
					'itemId' : "nav2menuItem3",
					'itemName' : "采购合同调价申请",
					'needShow' : bModuleEBP && bModuleSCM_CT,
					"itemUrl" : "/ebvp/contract/initCtPriceAd"
				}, {
					'itemId' : "nav2menuItem4",
					'itemName' : "合同价格信息表调整申请",
					'needShow' : bModuleEBP && bModuleSCM_CT,
					"itemUrl" : "/ebvp/contract/initCtPrice"
				} 
            ]
            ,
            'callback': function() {
        		return false;
        	}
        },
        {
            'itemId': "nav3",
            'itemName': msg15,
            'needShow': bModuleEBPOrSCM_PU,
            'itemUrl': ".",
            'subMenu': [
                {
                    'itemId': "nav3menuItem0",
                    'itemName': msg16,
                    'needShow': bModuleEBPOrSCM_PU,
                    "itemUrl": "/ebvp/order/confirmlist?menuid=31"
                },
                {
                    'itemId': "nav3menuItem1",
                    'itemName': msg17,
                    'needShow': bModuleSCM_PU && bStdVersion,
                    "itemUrl": "/ebvp/order/exestatuslist?menuid=32"
                },
                {
                    'itemId': "nav3menuItem2",
                    'itemName': msg18,
                    'needShow': bModuleSCM_PU,
                    "itemUrl": "/ebvp/order/exeinfolist?menuid=33"
                }
            ]
            ,
            'callback': function() {
        		return false;
        	}
        },
        {
            'itemId': "nav4",
            'itemName': msg19,
            'needShow': bModuleEBVSCOrSCM_PU,
            'itemUrl': ".",
            'subMenu': [
                {
                    'itemId': "nav4menuItem0",
                    'itemName': msg20,
                    'needShow': bModuleSCM_PU,
                    "itemUrl": "/ebvp/other/goQryPageFromList?menuid=36"
                },
                {
                    'itemId': "nav4menuItem1",
                    'itemName': msg21,
                    'needShow': bModuleSCM_PU,
                    "itemUrl": "/ebvp/other/sendPlanList?menuid=37"
                }
                ,
                {
                    'itemId': "nav4menuItem2",
                    'itemName': msg22,
                    'needShow': bModuleSCM_PU,
                    "itemUrl": "/ebvp/other/sendNoticeList"
                },
                {
                    'itemId': "nav4menuItem3",
                    'itemName': msg23,
                    'needShow': bModuleEBVSC,
                    "itemUrl": "/ebvp/schedulecoll/paichengconller/scheduleconfirm"
                }
            ]
            ,
            'callback': function() {
        		return false;
        	}
        },
        {
            'itemId': "nav5",
            'itemName': msg24,
            'needShow': bModuleSCM_IC,
            'itemUrl': ".",
            'subMenu': [
                {
                    'itemId': "nav5menuItem0",
                    'itemName': msg25,
                    'needShow': bModuleSCM_IC_SYS,
                    "itemUrl": "/ebvp/other/nowStorageList"
                },
                {
                    'itemId': "nav5menuItem1",
                    'itemName': msg26,
                    'needShow': bModuleSCM_PU && bModuleSCM_IC_EBP_SYS && bStdVersion,
                    "itemUrl": "/ebvp/other/addGoodsApplyList"
                },
                {
                    'itemId': "nav5menuItem2",
                    'itemName': msg27,
                    'needShow': bModuleSCM_IC_SYS,
                    "itemUrl": "/ebvp/other/useCountList"
                },
                {
                    'itemId': "nav5menuItem3",
                    'itemName': msg28,
                    'needShow': bModuleSCM_IC,
                    "itemUrl": "/ebvp/other/arrGoodsList?menuid=52"
                },
                {
                    'itemId': "nav5menuItem4",
                    'itemName': msg29,
                    'needShow': bModuleSCM_IC,
                    "itemUrl": "/ebvp/other/storageList?menuid=53"
                },
                {
                    'itemId': "nav5menuItem5",
                    'itemName': msg30,
                    'needShow': bModuleSCM_IC,
                    "itemUrl": "/ebvp/other/supInfoList?menuid=51"
                },
                {
                    'itemId': "nav5menuItem6",
                    'itemName': msg31,
                    'needShow': bModuleSCM_IC_SYS,
                    "itemUrl": "/ebvp/other/backGoodsHandlerList"
                }
            ]
            ,
            'callback': function() {
        		return false;
        	}
        },
        {
            'itemId': "nav6",
            'itemName': msg32,
            'needShow': bModuleARAPOrSCM_PU,
            'itemUrl': ".",
            'subMenu': [
                {
                    'itemId': "nav6menuItem0",
                    'itemName': msg33,
                    'needShow': bModuleSCM_PU,
                    "itemUrl": "/ebvp/other/invoiceList?menuid=54"
                },
                {
                    'itemId': "nav6menuItem1",
                    'itemName': msg34,
                    'needShow': bModuleARAP && bStdVersion,
                    "itemUrl": "/ebvp/other/paymentList?menuid=55"
                }
            ]
            ,
            'callback': function() {
        		return false;
        	}
        }
    ];
    /* 导航栏及下拉菜单 */
    $( "#signedInNavigatorBar" ).UINavigator({ 'items': signedIn });

	// 设置导航菜单状态。
	var config = {
		// 首页
		"nav0" : [ "pubmain", "infopub" ],
		// 投标
		"nav1" : [ "sourcing" ],
		// 合同
		"nav2" : [ "contract" ],
		// 订单
		"nav3" : [ "order" ],
		// 发货排程
		"nav4" : [ "goQryPageFromList", "sendNoticeList", "qrySendNotice",
				"qrySendNoticeDetail", "exportSendNotice", "goToAddPage",
				"goQryPageFromList", "goQryPageFromAdd", "addQryData2NewPage",
				"saveMySendPlan", "deleteSendNotice", "cmtMySendPlan",
				"goback2AddPage", "goback2List", "goBack2SenNoticeList",
				"sendPlanList", "qrySendPlan", "sendPlanSave",
				"exportSendPlan", "schedulecoll" ],
		// 库存不用配置，不配置的全部为库存
		// 结算
		"nav6" : [ "invoiceList", "qryInvoiceList", "exportInvoice",
				"invoiceDetail", "goBack2Invoice", "paymentList",
				"qryPaymentList", "exportPayment", "paymentDetail",
				"goBack2Payment" ]

	};
	// 根据url来判断是哪个模块
	var url = window.location.href;
	var hit = false;
	for ( var module in config) {
		var pages = config[module];
		for ( var i = 0; i < pages.length; i++) {
			if (url.indexOf(pages[i]) != -1) {
				$("#" + module).addClass("focus");
				hit = true;
				break;
			}
		}
	}
	// 如果不在配置中则全部为【库存】nav5
	if (!hit) {
		$("#nav5").addClass("focus");
	}
});